﻿/**
* @projectName   cvvision
* @file          ISignalBridge.h
* @brief         信号槽桥接
* @author        GuoFeng
* @contact        805305774@qq.com/feng.guo@micro-i.com.cn
* @date          2022-04-12
*/

#ifndef ISIGNALBRIDGE_H
#define ISIGNALBRIDGE_H

#include <QObject>
#include "Interface_Global.h"

namespace CVV {
namespace Interface {

class INTERFACE_EXPORT ISignalBridge : public QObject
{
    Q_OBJECT

public:
    static ISignalBridge* instance();

    /**
     * @brief setLoopIndex 循环索引
     * @param index
     */
    void setLoopIndex(int index);
    int getLoopIndex() const;

    /**
     * @brief setLoopSize 循环次数
     * @param iSize
     */
    void setLoopSize(int iSize);
    int getLoopSize() const;

    /**
     * @brief setLocale
     * @param locale
     */
    void setLocale(const QString &locale);
    QString getLocale() const;

signals:
    /**
     * @brief sigEngineRunFinished 引擎执行结束
     */
    void sigEngineRunFinished();

    /**
     * @brief sigDefectImportSuccess 缺陷拼音码导入成功
     * @param lstDefectPinYinCode
     */
    void sigDefectImportSuccess(const QStringList &lstDefectPinYinCode);

    /**
     * @brief sigChangeLanguage 切换语言
     * @param localeName
     */
    void sigChangeLanguage(const QString &localeName);

    /**
     * @brief sigOpenSubprocess 打开子流程
     * @param fileName
     */
    void sigOpenSubprocess(const QString &fileName,
                           const QString &pluginCode,
                           const QString &flowId,
                           const QString &cellId,
                           const QVariant &varInputParam,
                           QString parentFlowName);

    /**
     * @brief sigUpdateSubprocessFlowTree 子流程树更新
     * @param flowId    主流程Id
     * @param cellId    主流程中子流程节点Id
     * @param subFlowId 子流程Id
     */
    void sigUpdateSubprocessFlowTree(const QString &flowId, const QString &cellId, const QString &subFlowId);

private:
    explicit ISignalBridge(QObject *parent = nullptr);
    virtual ~ISignalBridge();

private:
    std::atomic_int m_iLoopIndex;
    std::atomic_int m_iLoopSize;
    QString m_strLocale;
};

}
}

#endif // ISIGNALBRIDGE_H
